package cn.cloud.butler.webapi.repository;

import cn.cloud.butler.webapi.domain.MachineOutputStatistics.MachineOutputSummary;
import cn.cloud.butler.webapi.domain.ProduceNameDistinctResult;
import cn.cloud.butler.webapi.domain.ProduceSumEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by zhouguocheng on 2018-12-03-上午 10:30
 */
public interface ProductSumRepository extends JpaRepository<ProduceSumEntity,Integer> {

    @Query(value = "SELECT DISTINCT (ProduceName) as produceName FROM ProduceSum table1, " +
            "(SELECT MacSN FROM CompMacSN WHERE CompID = ?1 ) table2 " +
            "WHERE table1.MacSN = table2.MacSN",nativeQuery = true)
    List<String> findByCompid(Long compID);


}
